package com.c2c.converter;

import com.c2c.po.enums.impl.CommentsState;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class CommentStateConverter implements Converter<Integer, CommentsState> {


    @Override
    public CommentsState convert(Integer integer) {
        for (CommentsState commentsState : CommentsState.values()){
            if (commentsState.getCode() == integer){
                return commentsState;
            }
        }
        return null;
    }

}
